package com.ruoyi.paip.util;

import com.fasterxml.jackson.core.type.TypeReference;
import com.ruoyi.paip.domain.paip.ConditionData;
import com.ruoyi.paip.domain.paip.Response;

import java.util.HashMap;
import java.util.Map;

/**
 * TODO to describe JsonTest
 *
 * @author 辛凤文
 * @since 1.0
 */
public class JsonTest {
    public static void main(String[] args) {
        Map<String, String> requestParams = new HashMap<>();
        requestParams.put("functionId", "pp.own.channel.biz.index.catAndCondtion");
        requestParams.put("appid", "paipai_wx");
        //requestParams.put("client", "m");
        //requestParams.put("ext", "%7B%22referer%22%3A%22wx4987f0b3b115aae2%2F4.4.1%2Fpages%2Findex%2Findex%22%7D");
        //requestParams.put("t", "1736238045618");
        //requestParams.put("h5st", "20250107162045619%3Byyqe8vlh1ezzuee2%3Bd9bf4%3Btk03ac7df1c3f18pMyszKzMrMTVLesls4UHwq6i74xMlReQ2xz9b2XsPj4YE6KDsbATOXOvJ7wAW0BZ_bEQiu0Jj88Yt%3Bc58b258c19af1e6f2e1a50f69e7d3e28%3B4.9%3B1736238045619%3Bq3EpJjYSGWENxWVfD6FOzXVPyGEjLDIj7SFjLrJp-jZf9HIg3T0UzelNJrJdJTEjLrJp-jJX9CUZb25R4bFbJrJdJ31QHyVT5ipjLD7N%3B49318bef48b5ae775e7c475e12c736b1");
        //requestParams.put("uuid", "17359920210391667687448");
        //requestParams.put("eid", "93A92CCD48893AA941C77D3754ADD7A99A97F22E");
        //requestParams.put("body", "%7B%22visitChannel%22%3A2%2C%22filterExclusiveStock%22%3Afalse%7D");

        Map<String, String> requestHeaders = new HashMap<>();
        requestHeaders.put("referer", "https://servicewechat.com/wx4987f0b3b115aae2/127/page-frame.html");

        String res = PaipUtils.request(PaipUtils.URL_PAIP, PaipUtils.METHOD_GET, requestParams, requestHeaders, null);
        TypeReference<Response<ConditionData>> typeReference =
                new TypeReference<Response<ConditionData>>() {
                };
        Response<ConditionData> data = JsonUtils.parse(res, typeReference);
        System.out.println(data);
    }
}
